package org.common.eureka.service;

import org.common.eureka.feign.FeignConfig;
import org.common.eureka.service.fallback.UserFeignClientFallbackFactory;
import org.sam.commons.entity.pojo.SecUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

@FeignClient(name = "MICROSERVICE-USER",
        configuration = FeignConfig.class,
        fallbackFactory = UserFeignClientFallbackFactory.class)
public interface IUserFeignClient {

    /**
     * @param id
     * @return
     */
    @GetMapping("/user/json/{id}")
    public String queryJsonById(@PathVariable String id);

    /**
     * 获取用户对象信息
     *
     * @param id
     * @return
     */
    @GetMapping("/user/{id}")
    public SecUser queryOne(@PathVariable String id);

    @GetMapping("/user/all")
    public List queryAll();

    @GetMapping("/user/name/{userName}")
    public String queryJsonByName(@PathVariable String userName);
}
